var common = {
    success: function(msg,url){
        layer.msg(msg, {icon: 6,time: 500},function(){
            window.location.href=url;
        });
    },
    error: function(msg){
        layer.msg(msg, {icon:5, time: 500});
    },
    status: function (url,id,objectstate) {
        $.post(url,{id:id},function(data){
                if(data.status > 0){
                    alert(data.msg);
                }else{
                    if(data.data == 1){
                        objectstate.removeClass('btn-warning').addClass('btn-info').html('正常');
                    }else{
                        objectstate.removeClass('btn-info').addClass('btn-warning').html('禁用');
                    }
                }
            },'json');
    },
    del: function (url,id,gotourl){
        $.post(url, {id:id}, function(data){
            if(data.status > 0){
                common.error(data.msg);
            }else{
                common.success(data.msg,gotourl);
            }
        }, 'json');
    }
};
